package presentation.dapartmentofficeteacherui;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JButton;
import javax.swing.JPanel;
import presentation.mainui.MainUI;
import presentation.officeteacherui.OtherInfoPanel;
import presentation.userui.UserUI;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.net.URL;

public class DepartmentOfficeTeacherUI {

	private JFrame frame;
	private MyPanel panel;

	/**
	 * Launch the application.
	 */


	/**
	 * Create the application.
	 */
	public DepartmentOfficeTeacherUI() {
		initialize();
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		frame = new JFrame();
		frame.setBounds(100, 100, 600, 460);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.getContentPane().setLayout(null);
		
		JButton btnNewButton = new JButton("\u8BFE\u7A0B\u5904\u7406");
		btnNewButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				panel.removeAll();
				panel.add(new DealCoursePanel().panel);
				panel.repaint();
			}
		});
		btnNewButton.setBounds(10, 89, 125, 23);
		frame.getContentPane().add(btnNewButton);
		
		JButton btnNewButton_1 = new JButton("\u53D1\u5E03\u6559\u5B66\u8BA1\u5212");
		btnNewButton_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				panel.removeAll();
				panel.add(new PublishTeachPlanPanel().panel);
				panel.repaint();
			}
		});
		btnNewButton_1.setBounds(10, 165, 125, 23);
		frame.getContentPane().add(btnNewButton_1);
		
		JButton btnNewButton_3 = new JButton("\u9000\u51FA\u767B\u5F55");
		btnNewButton_3.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				frame.dispose();
				MainUI.userUI=new UserUI();
			}
		});
		btnNewButton_3.setBounds(10, 319, 125, 23);
		frame.getContentPane().add(btnNewButton_3);
		
		panel = new MyPanel();
		panel.setBounds(145, 0, 439, 422);
		frame.getContentPane().add(panel);
		panel.setLayout(null);

		MyPanel split_panel=new MyPanel();
		split_panel.setBounds(137,0,2,460);
		panel.add(split_panel);
		
		JButton btnNewButton_2 = new JButton("\u8FD4\u56DE");
		btnNewButton_2.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				panel.removeAll();
				panel.repaint();
			}
		});
		btnNewButton_2.setBounds(10, 229, 125, 23);
		frame.getContentPane().add(btnNewButton_2);
		frame.setVisible(true);
	}
	
	public class MyPanel extends JPanel{
		public void paintComponent(Graphics g){
			URL imgurl=DepartmentOfficeTeacherUI.class.getResource("/img/departmentteacher.jpg");
			Image image=new ImageIcon(imgurl).getImage();
			g.drawImage(image,0,0,this);
		}
	}
}
